"use strict";
cc._RF.push(module, '3c961lcRWREUKF3h3MK988I', 'Path');
// cases/entity/Path.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Path = /** @class */ (function () {
    function Path() {
        this._list = [];
        this._curIndex = 0;
        this._isLooped = false;
        this._isLooped = false;
    }
    Path.prototype.createRandomPath = function (numPoint, minX, minY, maxX, maxY, isLoop) {
        if (isLoop === void 0) { isLoop = false; }
        this.clear();
        var midx = (maxX - minX) * 0.5;
        var midy = (maxY - minY) * 0.5;
        var smaller = Math.min(midx, midy);
        var spacing = 2 * Math.PI / numPoint;
        for (var i = 0; i < numPoint; i++) {
            var radiusdist = Math.random() * smaller * 0.8 + (smaller * 0.2);
            var temp = cc.v2(radiusdist, 0);
            temp.rotateSelf(i * spacing);
            // temp.x += midx; temp.y += midy;
            this._list.push(temp);
        }
        this._isLooped = isLoop;
    };
    Path.prototype.getCurPoint = function () {
        return this._list[this._curIndex];
    };
    Path.prototype.isFinish = function () {
        return this._curIndex == this._list.length - 1;
    };
    Path.prototype.setLoop = function (loop) {
        this._isLooped = loop;
    };
    Path.prototype.addPoint = function (newPoint) {
        this._list.push(newPoint);
    };
    Path.prototype.clear = function () {
        this._list.length = 0;
        this._curIndex = 0;
    };
    Path.prototype.getPath = function () {
        return this._list;
    };
    Path.prototype.setUpNextPoint = function () {
        if (++this._curIndex == this._list.length) {
            if (this._isLooped) {
                this._curIndex = 0;
            }
            else {
                this._curIndex = this._list.length - 1;
            }
        }
    };
    return Path;
}());
exports.default = Path;

cc._RF.pop();